UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd6fLVMiTHNtKfW5touFg0Nno3euWjEV54mszcB1yNyo=' 
WHERE 
  key_id = '09a5b8af186624eb28363192cafa309219a7b0a38b300b3e7018f261b7b44fc0' 
  AND (
    token = 'd6fLVMiTHNtKfW5touFg0Nno3euWjEV54mszcB1yNyo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034