UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bBQ7hWV9Qz7aOW/uMAxMdMGuf4uoO6EZPu6JefjAlLg='
WHERE
key_id = 'ae6c91819292fb2e667eaa2a4c11d5e94d120d26677be4289600843c12542230'
AND (
token = 'bBQ7hWV9Qz7aOW/uMAxMdMGuf4uoO6EZPu6JefjAlLg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)