UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wJreLT9+PFvuJlTctD0xzpN/dp19K1Cd+8p1pSX2QMk='
WHERE
key_id = 'eb8e5650779703e017d5fbaa666077da0d09d9df676d652c279fbe71d16c7531'
AND (
token = 'wJreLT9+PFvuJlTctD0xzpN/dp19K1Cd+8p1pSX2QMk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)