UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KRQqIZCf1/FiHdAIk0WhUTIVqDZ3DzBM/f6y++fDbSA='
WHERE
key_id = '39322728cae11044873f03bf2d3664dd6b057fe94e22609b3ad03650d4b381f6'
AND (
token = 'KRQqIZCf1/FiHdAIk0WhUTIVqDZ3DzBM/f6y++fDbSA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)