UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bZxOm8yEZwQlNv7zDKb5mHQNj7A4RfEvt71Rc1Fq3eY='
WHERE
key_id = 'ad6b18b3ce1b40be0890a1074292bf31f697d7c59936e54dee3e9bb4e8e18fbe'
AND (
token = 'bZxOm8yEZwQlNv7zDKb5mHQNj7A4RfEvt71Rc1Fq3eY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)