UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y+QApwA24qTrjH0LnN7pZ59Bb5pIpD9RhFd8itcKxgA=' 
WHERE 
  key_id = '24651861a1145859aa99535b68cbf4bb37fe127097f7511e8056e654aea01588' 
  AND (
    token = 'y+QApwA24qTrjH0LnN7pZ59Bb5pIpD9RhFd8itcKxgA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035