UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y94XdD8fjtUkuaF5ZDj38ovFmbuP/W7dkTgNpeBEOhc=' 
WHERE 
  key_id = '95729d7712798b3ee8c65ea0dd555e02da24a02e8c4a12d9755a9a07a4740775' 
  AND (
    token = 'Y94XdD8fjtUkuaF5ZDj38ovFmbuP/W7dkTgNpeBEOhc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058