UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IQcjA5STYZG/WYICUctlIGJHX5Q8K760cTvw9a7Ueqc='
WHERE
key_id = 'bf8db8d9a36b9aed30689236e0acb6fab82708e4542cf75a437f5fbf4e75c7a6'
AND (
token = 'IQcjA5STYZG/WYICUctlIGJHX5Q8K760cTvw9a7Ueqc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)