UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eoYz0yNZs49fVU+tiNj/YR0Il8EhW7zdCV4fXM7o9Fo=' 
WHERE 
  key_id = 'bb71e61c328488747ac60cc9f652e95eebc58e32f195f76f1486740969d5631e' 
  AND (
    token = 'eoYz0yNZs49fVU+tiNj/YR0Il8EhW7zdCV4fXM7o9Fo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025