UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A4YQTe5pDj6SSBhh+kToKDTAkRROe7ybMLpQRGaTwyc=' 
WHERE 
  key_id = 'df30f519e587cacaf7b805514f8326554603b16c50a3cf27ba12e61bfeed432f' 
  AND (
    token = 'A4YQTe5pDj6SSBhh+kToKDTAkRROe7ybMLpQRGaTwyc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030