UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6vlOVCHWUsyW6yUXpiJTob6f9GfgprVGMVvwgBH3Mgg='
WHERE
key_id = '94a79ab12bd9668a357074ecb462d4bf3313250d92bd3beb98c6e93c54687676'
AND (
token = '6vlOVCHWUsyW6yUXpiJTob6f9GfgprVGMVvwgBH3Mgg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)