UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ycnp9CMHdh49FX8LR4SmDp/NJamP0oFfaYEnGwRUks0=' 
WHERE 
  key_id = '4e73ea3ac98926740bf62e406a36349751a6615b96c64c5e96d9eb6d2daa7358' 
  AND (
    token = 'Ycnp9CMHdh49FX8LR4SmDp/NJamP0oFfaYEnGwRUks0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038