UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'piVsFM8a/6l6zNEahWqyeqL6DMSOreusSb2NcNqxyBo=' 
WHERE 
  key_id = '9d1573816709de00126de4f73a4b0109c8584ad7236575e6be593fa1d1dfb27e' 
  AND (
    token = 'piVsFM8a/6l6zNEahWqyeqL6DMSOreusSb2NcNqxyBo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023