UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VUU6enOcv+6GfxpHL3jfUos2P7hv3lEFC44PgQAA05M=' 
WHERE 
  key_id = 'a5f56ff18cff7160ea800339e71d30d932de155046b7c6ab21e45891c21edc35' 
  AND (
    token = 'VUU6enOcv+6GfxpHL3jfUos2P7hv3lEFC44PgQAA05M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042