UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eAezFy/AVU+849+rkJwQqeGk/XwxY1Mkp9cLwDTpeDk=' 
WHERE 
  key_id = '853ab3b81e5cfb3e2178d0d55deede5740a1d1d155bcd005d38bcbf76e19cddf' 
  AND (
    token = 'eAezFy/AVU+849+rkJwQqeGk/XwxY1Mkp9cLwDTpeDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026