UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8e8LoMq/0N4VITl1FwaTjf15Ry8aemzhFUotQCgPiPA=' 
WHERE 
  key_id = '07dd8d83e61282772743d055acbf331400743892671cd0f1304c8b25ae041d2e' 
  AND (
    token = '8e8LoMq/0N4VITl1FwaTjf15Ry8aemzhFUotQCgPiPA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023