UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DWkw5X31U3BKXK4RWXI4k7P51PLr7u3Eu66jgAv9PmY='
WHERE
key_id = 'f99f38d588f858a440b333e999deb1ef1d76cfa3881345cbff7bfec7ea0fc47e'
AND (
token = 'DWkw5X31U3BKXK4RWXI4k7P51PLr7u3Eu66jgAv9PmY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)