UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lPSJdJBzXptydDHq4AJTKc6E3AxEYUWfV7pS109btus=' 
WHERE 
  key_id = '30010f7de4173098504b058fd65ed384074e45b8b7fd3d6b1ac8c59ca7fe68c2' 
  AND (
    token = 'lPSJdJBzXptydDHq4AJTKc6E3AxEYUWfV7pS109btus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029