UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7r9XuKItSAHNNIDxyDXQJhl+DLPACKRadmwHYcG/5ws='
WHERE
key_id = '254dc8862ce391a532f697b4446af13d0808d012f9842f903974561145dcc96a'
AND (
token = '7r9XuKItSAHNNIDxyDXQJhl+DLPACKRadmwHYcG/5ws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)