UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qd2DuWteS2mre3MLez7SOCN+QJrB3fKuBQ6hBgXTLL4=' 
WHERE 
  key_id = '69274f30cce5de0b2050bf7a14d613e310a8f5d8593eb8774fd67047ad6ad1e6' 
  AND (
    token = 'Qd2DuWteS2mre3MLez7SOCN+QJrB3fKuBQ6hBgXTLL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037