UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iLYbJeO2Q9wE65fXJvJmE0O6SPVn+sJTV+HFzAW0NGU=' 
WHERE 
  key_id = '12e9d9968ff7199a5ce4f151e6e92174efb7c5a19e4a79dc801e7ac170f51b52' 
  AND (
    token = 'iLYbJeO2Q9wE65fXJvJmE0O6SPVn+sJTV+HFzAW0NGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030