UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QM/DUMm1ljyn9CZ4WP3ICvxGpzRAo1Zcak5ghar/1I8=' 
WHERE 
  key_id = 'fb8c75d35e36073944c8174142af70ff4fe8b0417e4406a75d6024b1b5573038' 
  AND (
    token = 'QM/DUMm1ljyn9CZ4WP3ICvxGpzRAo1Zcak5ghar/1I8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037