UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cwgaVvhghWEOzGi3w1h4MACVgmhUwdPDlrCQUV9GEMs=' 
WHERE 
  key_id = 'd76bc41bb31d0dd1b66eabaf8ba0175f4521e3a89cff932cafae3fdd2e2056f0' 
  AND (
    token = 'cwgaVvhghWEOzGi3w1h4MACVgmhUwdPDlrCQUV9GEMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057