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

Query time 0.00023