UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ib4cKHM0PQHyXDtnfbXhdBliAy0g5insQtfUQkLTatc=' 
WHERE 
  key_id = 'c918e6ff9c09d9c3f35dde2b2b7ebbdd47d55790803f5802f4d54d258ac3aa04' 
  AND (
    token = 'Ib4cKHM0PQHyXDtnfbXhdBliAy0g5insQtfUQkLTatc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022