UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6O6q9Jq7z+zBzd4ybaO/bR1wzYIGIE72nYDNVcE1MzI='
WHERE
key_id = '0e8054ea54f951827eecfd6985c5660e71d3be3dcca2cefaf103cc6a6113563a'
AND (
token = '6O6q9Jq7z+zBzd4ybaO/bR1wzYIGIE72nYDNVcE1MzI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)