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