UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0OBtoP3gj58a1h+QlO9hQN3WqceARn0TBC+z01dwymo='
WHERE
key_id = '39bb3193ede75fd841cc1d921562a6a072e83cc69be60909f8faf96b525abe8e'
AND (
token = '0OBtoP3gj58a1h+QlO9hQN3WqceARn0TBC+z01dwymo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)