UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XvCmD8Q4TQBAKr79Qvh+MkvZLBoWVg7NbONnkIgfoe4='
WHERE
key_id = 'bd574a1186eeb0561938468928eb0c3d192a908aa941b4fb5c2f40793d25a162'
AND (
token = 'XvCmD8Q4TQBAKr79Qvh+MkvZLBoWVg7NbONnkIgfoe4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)