UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iQZGTh+AyXwZa1K1m58VEC/jSn17muojDohxT1ndoQA=' 
WHERE 
  key_id = '9afc7884d6c1828f6a0571d80e30e66bfb31f920de15a63e76c33022c425a6e6' 
  AND (
    token = 'iQZGTh+AyXwZa1K1m58VEC/jSn17muojDohxT1ndoQA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032