UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O/a3dPkEUsFjNGp4IKAnHMguUeYLEJHNZ4Bm/GYN2a8=' 
WHERE 
  key_id = 'd4b15f0a237e88be9b5c0d5c1566982087f8822ca14caa26d4f5f66a1476b57d' 
  AND (
    token = 'O/a3dPkEUsFjNGp4IKAnHMguUeYLEJHNZ4Bm/GYN2a8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026