UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '74gDEI+qSAwUrFlWOJ2wUpPXp+1f3LIZ8ABZ/K0on54=' 
WHERE 
  key_id = '00717eb45f0673088d76b1e6f7419fcdaa897c6cbce3b5aad80344acc98da13b' 
  AND (
    token = '74gDEI+qSAwUrFlWOJ2wUpPXp+1f3LIZ8ABZ/K0on54=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041