UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'azyZCvhOBX8RtQI3V9qaTqBzbyJhaObjngbyjp2S1wU=' 
WHERE 
  key_id = '7f55d13a301153bd33be08a34062ee1d380e8d62baf3389e5b8f7f63bade3bc6' 
  AND (
    token = 'azyZCvhOBX8RtQI3V9qaTqBzbyJhaObjngbyjp2S1wU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030