UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BvO2Cf+sQbIRJ7SaO2RGoBYiLRulojnfBFgq/YYOL0Y=' 
WHERE 
  key_id = '5072da06069f0c98dafa9e4158fdbaba2f8c464b516d622036dad5ce8ef1c409' 
  AND (
    token = 'BvO2Cf+sQbIRJ7SaO2RGoBYiLRulojnfBFgq/YYOL0Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032