UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qI1apWNHgy8wLxjzU416sdoW/HMMLn8JhA0cQHqH8+0='
WHERE
key_id = 'e102395c738d8912b4f88498901ee83facec7a4605d93e9a4d825216ec3afabd'
AND (
token = 'qI1apWNHgy8wLxjzU416sdoW/HMMLn8JhA0cQHqH8+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)