UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uh1jN0wDqLlQsNF0DDEU1zJdB9A9U0iU8+upSxbR0dM=' 
WHERE 
  key_id = 'c9c2f598bee6ed4dbc2d4a5bd5ea027498d73b081482fffe257857bce5f29487' 
  AND (
    token = 'Uh1jN0wDqLlQsNF0DDEU1zJdB9A9U0iU8+upSxbR0dM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021