UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kv2RGFQfw17uj7SBdXvOJuIU4QCuKxjb0usfn+YM9mM='
WHERE
key_id = 'e685df198d523f5f894c2629cbed3ff1a8c14e834a017a8045d67895f23a8c9e'
AND (
token = 'kv2RGFQfw17uj7SBdXvOJuIU4QCuKxjb0usfn+YM9mM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)