UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dwy30uHYaIEXvL8AsH9d5nkaK1J8Qs/hgWfwE6571r0='
WHERE
key_id = 'ee0713e2407beace60c5c792ac1f529b205401b0744a8fedcad3689d8e83a41d'
AND (
token = 'dwy30uHYaIEXvL8AsH9d5nkaK1J8Qs/hgWfwE6571r0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)