UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lydsDCOifL5Kkyx+BLojk1j2DLChtUptg88wGcLP7tU=' 
WHERE 
  key_id = '1357cd37bd150606b4944f6723cbb71f22911e6ee5bb7c0101a5bc5ce731c638' 
  AND (
    token = 'lydsDCOifL5Kkyx+BLojk1j2DLChtUptg88wGcLP7tU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042