UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tw3jJptmz+qgW6pG6oDFvCyqN+yY0X0sRNLw/uypf3w=' 
WHERE 
  key_id = '82862bbf983b33c0484ee28cdbaa701fa1082ec6819c52e2859083913acb887e' 
  AND (
    token = 'Tw3jJptmz+qgW6pG6oDFvCyqN+yY0X0sRNLw/uypf3w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040