UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z1gTf3QTsdPlJ7wZfr9UNAO5fJ8DT2XPsBqJfLRHWic='
WHERE
key_id = '01659d078105ecdc6f224e5f7628c27e8613c8407056ca969d79496742f78729'
AND (
token = 'Z1gTf3QTsdPlJ7wZfr9UNAO5fJ8DT2XPsBqJfLRHWic='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)