UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1w1vjxk9oMD5hLps4iYYVXS6fIGOJLsE2Zwl1DeGq0g=' 
WHERE 
  key_id = '6256f518f8a586eeea8b7e2327c17e6c2591807bd5332ad5bde306ed1dac229a' 
  AND (
    token = '1w1vjxk9oMD5hLps4iYYVXS6fIGOJLsE2Zwl1DeGq0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030