UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm/7icv6yYxN28nTJ3mCSqi90Iv7F43OSc2L6esJYZmA='
WHERE
key_id = '198a14ead8fb641680ad72d43d936efc213a3a45c1d7ca27def4cc084fce0f12'
AND (
token = 'm/7icv6yYxN28nTJ3mCSqi90Iv7F43OSc2L6esJYZmA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)