UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q6ehiE5Q7p+mkrU3YeHhNxW9vuU6xCz+1/4AQWUMBd4=' 
WHERE 
  key_id = '4bebd0c225534e19778e8d22a11c89739ca4c4c849bbbb47b7697842a3aca2d3' 
  AND (
    token = 'q6ehiE5Q7p+mkrU3YeHhNxW9vuU6xCz+1/4AQWUMBd4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019