UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VX9AQt93QlSja7wx3itEPeYIdlnRkFVUlJptp3EStkk=' 
WHERE 
  key_id = 'e5313a6773fa29b9fa771a3c67e55d3ecfa57d37f5a88e4070bc50ecc50627b8' 
  AND (
    token = 'VX9AQt93QlSja7wx3itEPeYIdlnRkFVUlJptp3EStkk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031