UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ip4rRH5cr7Ks0b2NOqkVxL6Anl9zlT9YG3ccXQO6KsM='
WHERE
key_id = 'e87b5f47bf7ebce07c66eea8047ae90841ebb7e270f2d1dc978c46ec82308601'
AND (
token = 'Ip4rRH5cr7Ks0b2NOqkVxL6Anl9zlT9YG3ccXQO6KsM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)