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

Query time 0.00024