UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lhpDjzWuvqH/7UP56xsldOtbGmht3HEXiaBkWXVJYv0='
WHERE
key_id = 'b50ff6ec6871695ee812c1fb8720cb28642d27b8abb0f7157acf585504d5e398'
AND (
token = 'lhpDjzWuvqH/7UP56xsldOtbGmht3HEXiaBkWXVJYv0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)