UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tFuE7V/hnYeusPnZXtIlSt7XzUnFon6ambepl1utgwI=' 
WHERE 
  key_id = 'cc456f58d8caa840188c779dd8966d87d522a8885039a2bc58f5d8e0aa1e32d4' 
  AND (
    token = 'tFuE7V/hnYeusPnZXtIlSt7XzUnFon6ambepl1utgwI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044