UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S2+FWH7EK45bICQ+NYejl0UqsiUp/5XHT9K+C4qGU8I=' 
WHERE 
  key_id = '74e2636f521968ea84604aa8c5336c43b25ccbd85d9b0b9c617c906610c73dc8' 
  AND (
    token = 'S2+FWH7EK45bICQ+NYejl0UqsiUp/5XHT9K+C4qGU8I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046