UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3uacqE6/MJLQ0mPbcUgDUbQvedGty1cq3lqglVMe+kI='
WHERE
key_id = '17f2589f04e21ad717efccee3deeb95f7b9f5015f733e8cce99d6513d2dff071'
AND (
token = '3uacqE6/MJLQ0mPbcUgDUbQvedGty1cq3lqglVMe+kI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)