UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KUzbw9iantCo94sdl5EUtx/YRzTt0eiBZ2UEmfWucOk=' 
WHERE 
  key_id = '591b1e657b08858061fe9c7992a04cbae95c779cc9179b25675bded7d1624b7a' 
  AND (
    token = 'KUzbw9iantCo94sdl5EUtx/YRzTt0eiBZ2UEmfWucOk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020