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