UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iSn1xMps6uO+bY3ZVsb7kvuYhE4RZVB0IYuG1VJ8XaA='
WHERE
key_id = 'a340672c86cf91764d37baf5ede58b26176f37ddec1d4cce075f1fde706986f1'
AND (
token = 'iSn1xMps6uO+bY3ZVsb7kvuYhE4RZVB0IYuG1VJ8XaA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)