UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ka7QiHGEEty3obOxHQB40okZ+BonDyt+GyVmpOceB60=' 
WHERE 
  key_id = '8cea39baa289de237dffb731b8dd6eacd1aace6b26ee0325ee69f45348d2370c' 
  AND (
    token = 'ka7QiHGEEty3obOxHQB40okZ+BonDyt+GyVmpOceB60=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047