UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'shTfy2eM95oTgxYMtM0Qv1ZkJDLW6ow+uV89WnIeLf4='
WHERE
key_id = '1ea7c24b34d157222840b228a561d260bf5cd5a009dcf7754418bcadaeacd2cf'
AND (
token = 'shTfy2eM95oTgxYMtM0Qv1ZkJDLW6ow+uV89WnIeLf4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)