UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Emngcn6yh5pTyZXRZmHJC01UxqfGf9TU1mljGjPMakQ=' 
WHERE 
  key_id = '7820b4fbc4633b482b068fbf3b3856de93370c1b01c0db04adf9d1194cc2cd6d' 
  AND (
    token = 'Emngcn6yh5pTyZXRZmHJC01UxqfGf9TU1mljGjPMakQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036