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

Query time 0.00049