UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4f7bd+W/U+AMB3ffFxyWJNlP7CzieCOkbRk2sC+3s8M='
WHERE
key_id = 'ac79027867af997ec1d7a2e1fd864068654eafbc31c8aa31dc62460f124a7745'
AND (
token = '4f7bd+W/U+AMB3ffFxyWJNlP7CzieCOkbRk2sC+3s8M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)