UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qCqKac6cPgdUepurx9h6AWADX0Kkofy6Q8yJEKIzelY=' 
WHERE 
  key_id = 'faeb6f1978a5da0e4a3bc62bd940bf9681353f31d7b84cd9562286c8a955a026' 
  AND (
    token = 'qCqKac6cPgdUepurx9h6AWADX0Kkofy6Q8yJEKIzelY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032