UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hGiMsNIJQLWizTy5Us9ekwtAPbW8cVH0Np2Qm+oo4pU=' 
WHERE 
  key_id = 'a0842ca59ead07465158ebb199f9fa2d1a6d9ae96b0efb01be4cbde999093d92' 
  AND (
    token = 'hGiMsNIJQLWizTy5Us9ekwtAPbW8cVH0Np2Qm+oo4pU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036