UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cDwo7IVGr+GcNrrLSmhXaHmaMKL4xJAVfFd2EOWmWBA='
WHERE
key_id = 'dc36086ed4536e8e7d97f16e62c718308ffe53195c52664ff6db920259cce6ed'
AND (
token = 'cDwo7IVGr+GcNrrLSmhXaHmaMKL4xJAVfFd2EOWmWBA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)