UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y1vso5SQtWeNtNaNG3V3Wjl8+Zob1zT4dry4t+onfv4='
WHERE
key_id = 'a6261664192c6887de551bd7bea79ea3ee91e44eafb7882e44a53588d645415a'
AND (
token = 'Y1vso5SQtWeNtNaNG3V3Wjl8+Zob1zT4dry4t+onfv4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)