UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nNjBzcIf3jeC7HFBgln7knCxH2+vfUSflidkXJOkZxg='
WHERE
key_id = 'cb16859dd75521eb68a4f805379b28d02cc9721bb548e6bc546e6ce87fa5adbf'
AND (
token = 'nNjBzcIf3jeC7HFBgln7knCxH2+vfUSflidkXJOkZxg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)