UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'shl62ZvL2n/88XXQ7BJooBiqLjoLvCed2hSXwH5I+sw='
WHERE
key_id = 'e845377a974edbf79348ec5ce163cda6fa4b4f1f2a825a3b90168a025360ea16'
AND (
token = 'shl62ZvL2n/88XXQ7BJooBiqLjoLvCed2hSXwH5I+sw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)