UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q63jrJzNlE3xaeIdqay8dD8EC5C2jpijt/mx7BUG1hI='
WHERE
key_id = 'd9c8f7e00f885e2aa8e5d9fcdc952b3ae83a0c16027521e4acf68969d73cef89'
AND (
token = 'Q63jrJzNlE3xaeIdqay8dD8EC5C2jpijt/mx7BUG1hI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)