UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gh1mxi9T9UTbE3JSH18PzCcYmYan9PhQit/5f/PCqQ0=' 
WHERE 
  key_id = '580e0f3305fe130a655440a710a65b08844dc9c58ba19c1c9040bfe22a30a422' 
  AND (
    token = 'Gh1mxi9T9UTbE3JSH18PzCcYmYan9PhQit/5f/PCqQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035