UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qr8JWpuoFZd/QhZ4HT62gsEbSoBFRaw8TynkkiVL8R0=' 
WHERE 
  key_id = 'e3109cc1df3ee21f59b15907beede9023fc34ef914bb398154c937238e8655cc' 
  AND (
    token = 'qr8JWpuoFZd/QhZ4HT62gsEbSoBFRaw8TynkkiVL8R0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040