UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tpippWMgafotXkgLMEo2vjUmj9m5OrDy8FJCmeKbIU4='
WHERE
key_id = '587e5c3593a82c6dd94c2988cecfc6e7bbd211b6638f3dea459b8ba32acaf10a'
AND (
token = 'tpippWMgafotXkgLMEo2vjUmj9m5OrDy8FJCmeKbIU4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)