UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KuxDEhgc+KIBwVeyAG7Kzz0txAZCiz6u3YZUlq26StQ='
WHERE
key_id = 'f6fa99db160ce1b286c04cf987350a90c7b80a83c7a5150c1f7b3e8032a34c3e'
AND (
token = 'KuxDEhgc+KIBwVeyAG7Kzz0txAZCiz6u3YZUlq26StQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)