UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J54FUFC3q5HvhF1glWeHLr31S85Ey1ePByI/z1C/E9o=' 
WHERE 
  key_id = '827a21feb38a6c3bac025a1389c4334d053a8efe56abcebba76656b019dfc6b4' 
  AND (
    token = 'J54FUFC3q5HvhF1glWeHLr31S85Ey1ePByI/z1C/E9o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030