UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TqOBVKtIP+Dydb0vTalK7XGSimVyAhm1fxzkIh8HmoM=' 
WHERE 
  key_id = '27fbffc2597e7f8ac7f0e56452fe61b6f574d362cf5f0d71cf37fd2baaa290c5' 
  AND (
    token = 'TqOBVKtIP+Dydb0vTalK7XGSimVyAhm1fxzkIh8HmoM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041