UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KRUvAjMmw0+w+Jq0mLzYXrWpTVonztxTyxd36Z8J3Vs=' 
WHERE 
  key_id = '5957fd85295e91e4eff3cd0407f06a236b1c00e74bbcaca98b91e345e4840a5f' 
  AND (
    token = 'KRUvAjMmw0+w+Jq0mLzYXrWpTVonztxTyxd36Z8J3Vs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035