UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X1vstVMVaGBexGGG8eTeiIwpU6AtDscqK/yrRQ0tIYs='
WHERE
key_id = 'b76b1df02f484d7b0144e91835ae8318c2fecffd5021c4ffb8049de1359f82b1'
AND (
token = 'X1vstVMVaGBexGGG8eTeiIwpU6AtDscqK/yrRQ0tIYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)