UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DMG6Y/HeX3KH6Sh4VAWJG1o8zv9Z601QG3RzNt6ELYY=' 
WHERE 
  key_id = 'b5a18f40c971ced756708c474f64425de65ff6192a4135e32013d9214d805013' 
  AND (
    token = 'DMG6Y/HeX3KH6Sh4VAWJG1o8zv9Z601QG3RzNt6ELYY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025