UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pLICvc2xuu+HrU5rykEYO7IH8uS3uFteHjPIOuy+A3U=' 
WHERE 
  key_id = '89e7bb5f1d652614c0773082f0d8cd52a53a41361d7daff27fb4f5904b6ad3f8' 
  AND (
    token = 'pLICvc2xuu+HrU5rykEYO7IH8uS3uFteHjPIOuy+A3U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038