UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TQ+qhnuGKNleyfFaIrOYP697xK4o7YwSB4NMj2mk1S0='
WHERE
key_id = '2c67696a38b72b2a0fe85fa33bb4412ca5a39024f2206c1efd29d13096baa29b'
AND (
token = 'TQ+qhnuGKNleyfFaIrOYP697xK4o7YwSB4NMj2mk1S0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)